package com.example.springboot06db.entity;

/**
 * @Name : com.cyd.demo.entity.SexEnum
 * @Description : 描述
 * Created by cyd on 2021-05-25 17:03:01
 */
public enum SexEnum {
    /**
     *
     */
    MALE(1, "男"),
    /**
     *
     */
    FEMALE(2, "女");

    private int id;
    private String name;

    SexEnum(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public static SexEnum getInstance(int id) {
        switch (id) {
            case 1:
                return MALE;
            case 2:
                return FEMALE;
            default:
                throw new IllegalArgumentException("没有");
        }
    }

    public String getName() {
        return name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }
}
